<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<BASE target="_self">
<META name="GENERATOR" content="IBM WebSphere Studio">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../estilo/estilo.css" rel="stylesheet" type="text/css">
<TITLE>CRUD Professor</TITLE>

<%@page
	import="com.fg.exemplocrudengenhariadesoftware.daobd.ProfessorDao,
				com.fg.exemplocrudengenhariadesoftware.model.Professor,
				java.util.*"
	session="true" isThreadSafe="true" isErrorPage="false"%>

<META name="GENERATOR" content="IBM WebSphere Studio">
</HEAD>
<STYLE type="text/css">
</STYLE>


<%
	ProfessorDao professorDao = new ProfessorDao();
	Professor professor = new Professor();
	String btAcao = "";

	if (request.getParameter("btAcao") != null) {
		btAcao = request.getParameter("btAcao");
		System.out.println(btAcao);
	}

	if (btAcao.equals("inserir")) {
		System.out.println(Integer.parseInt(request.getParameter("matricula")));
		System.out.println(request.getParameter("nome"));
		System.out.println(request.getParameter("senha"));
		
		professor.setMatricula(Integer.parseInt(request.getParameter("matricula")));
		professor.setNome(request.getParameter("nome"));
		professor.setSenha(request.getParameter("senha"));

		professorDao.insere(professor);
	}
%>

<SCRIPT language="JavaScript">
	
</SCRIPT>


<BODY bgcolor="#ffffff">
	<form id="professor" name="professor" action="professor.jsp" method="post">
		<table>
			<tr>
				<td>matricula</td>
				<td>nome</td>
				<td>senha</td>
			</tr>
			<tr>
				<td><input type="text" id="Matricula" name="matricula"
					value="<%request.getParameter("matricula");%>"></td>
				<td><input type="text" id="nome" name="nome"
					value="<%request.getParameter("nome");%>"></td>
				<td><input type="text" id="senha" name="senha"
					value="<%request.getParameter("senha");%>"></td>	

			</tr>
		</table>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p>
		  <input type="submit" name="btAcao" value="inserir" />
	  </p>
		<!--  
		<input type="button" name="btAcao" value="inserir"
			onclick="document.getElementById('professor').submit();">
		-->			
	</form>
</BODY>
</HTML>
